package com.usian.admin.controller;

import com.usian.admin.service.AdChannelService;
import com.usian.api.admin.ChannelControllerApi;
import com.usian.model.admin.dtos.ChannelDto;
import com.usian.model.admin.pojos.AdChannel;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.pojos.ApUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@RestController
@RequestMapping("api/v1/channel")
public class AdChannelController implements ChannelControllerApi {
    @Autowired
    private AdChannelService adChannelService;
    @RequestMapping("list")
    @Override
    public ResponseResult findByNameAndPage(@RequestBody ChannelDto dto) {
        return adChannelService.findByNameAndPage(dto);
    }

    @RequestMapping("save")
    @Override
    public ResponseResult save(@RequestBody AdChannel adChannel) {
        return adChannelService.save(adChannel);
    }
@PostMapping("update")
    @Override
    public ResponseResult update(@RequestBody AdChannel adChannel) {
        return adChannelService.update(adChannel);
    }
@GetMapping("del/{id}")
    @Override
    public ResponseResult deleteById(@PathVariable Integer id) {
        return adChannelService.deleteById(id);
    }



//    @RequestMapping("gid")
//    public ResponseResult gid(){
//        return null;
//    }
}
